package com.factory.iamp.service.impl;

import com.factory.iamp.dao.QuestionMapper;
import com.factory.iamp.pojo.QuestionManager;
import com.factory.iamp.service.QuestionService;
import com.factory.iamp.utils.helper.PageHelper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional(rollbackFor = Throwable.class)
public class QuestionServiveImpl implements QuestionService {
    @Resource
    QuestionMapper questionMapper;

    @Override
    public int QueryCount(String QueryStr) {
        return questionMapper.QueryCount(QueryStr);
    }

    @Override
    public List<QuestionManager> QueryListPaged(PageHelper data, String QueryStr) {
        return questionMapper.QueryListPaged(data.calOffset(), data.getLimit(), QueryStr);
    }

    @Override
    public void addQuestionRecord(
            String name, String department, String product_type, String process_type,
            String summary, String description, String method, String recorder, String file
    ) {
        questionMapper.addQuestionRecord(
                name, department, product_type, process_type, summary, description, method, recorder, file
        );
    }

    @Override
    public void alterQuestionRecord(
            int qid, String name, String department, String product_type, String process_type,
            String summary, String description, String method, String recorder, String file
    ) {
        questionMapper.alterQuestionRecord(
                qid, name, department, product_type, process_type, summary, description, method, recorder, file
        );
    }

    @Override
    public void deleteQuestionRecord(int qid) {
        questionMapper.deleteQuestionRecord(qid);
    }
}
